package my.concurrent.cnumber;

import org.testng.annotations.Test;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author admin
 */
public class CurrentNumberGenerator {


    @Test(invocationCount = 1)
    public void t1() {

        for (int i = 0; i < 10; i++) {
            Runnable r = () -> {
                int j = ThreadLocalRandom.current().nextInt(10);
                // 打印线程名字会导致没有输出？？但是jdk11可以输出
                System.out.println(j + " " + Thread.currentThread().getName());
//                System.out.println(j);
            };
            new Thread(r).start();
        }
    }

}
